Skip to content

Clean up legacy test scaffolding in cudf-polars#22535

Merged
rapids-bot[bot] merged 3 commits into
rapidsai:release/26.06from
madsbk:cleanup_legacy_tests
May 18, 2026
Merged

Clean up legacy test scaffolding in cudf-polars#22535
rapids-bot[bot] merged 3 commits into
rapidsai:release/26.06from
madsbk:cleanup_legacy_tests

Conversation

@madsbk
Copy link
Copy Markdown
Member

@madsbk madsbk commented May 16, 2026

Description

Removes assert_collect_raises, its callers, and the leftover executor=-era keyword plumbing that is no longer used anywhere else.

@madsbk madsbk self-assigned this May 16, 2026
@madsbk madsbk added improvement Improvement / enhancement to an existing function breaking Breaking change labels May 16, 2026
@github-actions github-actions Bot added Python Affects Python cuDF API. cudf-polars Issues specific to cudf-polars labels May 16, 2026
engine: GPUEngine,
collect_kwargs: CollectKwargs | None = None,
polars_collect_kwargs: CollectKwargs | None = None,
cudf_collect_kwargs: CollectKwargs | None = None,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never used

@GPUtester GPUtester moved this to In Progress in cuDF Python May 16, 2026
Comment on lines -161 to -174
def _process_kwargs(
collect_kwargs: CollectKwargs | None,
polars_collect_kwargs: CollectKwargs | None,
cudf_collect_kwargs: CollectKwargs | None,
) -> tuple[CollectKwargs, CollectKwargs]:
if collect_kwargs is None:
collect_kwargs = {}
final_polars_collect_kwargs = collect_kwargs.copy()
final_cudf_collect_kwargs = collect_kwargs.copy()
if polars_collect_kwargs is not None: # pragma: no cover; not currently used
final_polars_collect_kwargs.update(polars_collect_kwargs)
if cudf_collect_kwargs is not None: # pragma: no cover; not currently used
final_cudf_collect_kwargs.update(cudf_collect_kwargs)
return final_polars_collect_kwargs, final_cudf_collect_kwargs
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inlining, the function is only called once now.

return final_polars_collect_kwargs, final_cudf_collect_kwargs


def assert_collect_raises(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inlining the function is simpler to understand IMO. We now just do:

-        assert_collect_raises(
-            q,
-            cudf_except=pl.exceptions.ComputeError,
-            polars_except=pl.exceptions.InvalidOperationError,
-        )
+        with pytest.raises(pl.exceptions.InvalidOperationError):
+            q.collect()
+        with pytest.raises(pl.exceptions.ComputeError):
+            q.collect(engine=pl.GPUEngine(executor="in-memory", raise_on_fail=True))

@madsbk madsbk marked this pull request as ready for review May 16, 2026 10:36
@madsbk madsbk requested a review from a team as a code owner May 16, 2026 10:36
@madsbk madsbk requested a review from nirandaperera May 16, 2026 10:36
@rapidsai rapidsai deleted a comment from copy-pr-bot Bot May 16, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 79322a23-9a30-4ec1-b96f-dfbb03a02c4e

📥 Commits

Reviewing files that changed from the base of the PR and between 0c15199 and 2c35ce4.

📒 Files selected for processing (1)
  • python/cudf_polars/cudf_polars/testing/asserts.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • python/cudf_polars/cudf_polars/testing/asserts.py

📝 Walkthrough

Summary by CodeRabbit

  • Refactor

    • Simplified internal testing utility by removing redundant parameter and consolidating collection kwargs handling.
    • Replaced assertion helper with explicit exception checking for improved test clarity and maintainability.
  • Tests

    • Updated test cases to use direct exception assertions instead of removed utility function.

Walkthrough

This PR simplifies the cuDF Polars test assertion API by removing the cudf_collect_kwargs parameter from assert_gpu_result_equal, merging CPU/GPU kwargs logic, and deleting the assert_collect_raises helper. Tests are updated to use explicit pytest.raises for collection-time errors.

Changes

Assertion helper refactor and test migration

Layer / File(s) Summary
Assertion utilities refactoring
python/cudf_polars/cudf_polars/testing/asserts.py
assert_gpu_result_equal removes cudf_collect_kwargs parameter; CPU kwargs are built by merging collect_kwargs with polars_collect_kwargs, GPU kwargs come from collect_kwargs alone. Private helper _process_kwargs and public helper assert_collect_raises are deleted.
Test migration to direct pytest.raises
python/cudf_polars/tests/expressions/test_casting.py, python/cudf_polars/tests/expressions/test_datetime_basic.py, python/cudf_polars/tests/expressions/test_stringfunction.py, python/cudf_polars/tests/testing/test_asserts.py
Test modules remove assert_collect_raises imports and replace prior helper usage with explicit pytest.raises(...) blocks around both q.collect() and q.collect(engine=pl.GPUEngine(..., raise_on_fail=True)). The standalone test_collect_assert_raises() test is removed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


Possibly related PRs

  • rapidsai/cudf#22493: Both PRs refactor asserts.py's assertion utilities and engine-related calling conventions in assert_gpu_result_equal.

Suggested labels

non-breaking


Suggested reviewers

  • mroeschke
  • wence-
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main objective of the PR: removing legacy test scaffolding (assert_collect_raises) and related keyword plumbing from the cudf-polars testing module.
Description check ✅ Passed The description is directly related to the changeset, clearly explaining what is being removed: the assert_collect_raises utility, its callers, and outdated executor= keyword parameters.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]

This comment was marked as outdated.

Comment thread python/cudf_polars/cudf_polars/testing/asserts.py Outdated
Comment thread python/cudf_polars/tests/expressions/test_casting.py
@madsbk
Copy link
Copy Markdown
Member Author

madsbk commented May 18, 2026

/merge

@rapids-bot rapids-bot Bot merged commit 02f1051 into rapidsai:release/26.06 May 18, 2026
87 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python May 18, 2026
@madsbk madsbk deleted the cleanup_legacy_tests branch May 18, 2026 18:46
madsbk added a commit to madsbk/cudf that referenced this pull request May 18, 2026
PR rapidsai#22048 ("Bump polars upper bound to <1.40", merged today) added the new
`test_hconcat_strict_different_heights` test, which imports
`assert_collect_raises`. However, PR rapidsai#22535 ("Clean up legacy test
scaffolding", also merged into `release/26.06`) removed that helper.

The two PRs landed on `release/26.06` without the conflict being noticed.

On `main`, `test_hconcat.py` does not contain the strict-mode test, so the
issue is limited to `release/26.06`.
rapids-bot Bot pushed a commit that referenced this pull request May 19, 2026
#22558)

PR #22048 (merged today) added the new `test_hconcat_strict_different_heights` test, which imports `assert_collect_raises`. However, PR #22535 (also merged today) removed that helper.

The two PRs landed on `release/26.06` without the conflict being noticed.

On `main`, `test_hconcat.py` does not contain the strict-mode test, so the issue is limited to `release/26.06`.

Authors:
  - Mads R. B. Kristensen (https://github.com/madsbk)

Approvers:
  - Matthew Murray (https://github.com/Matt711)

URL: #22558
madsbk added a commit to madsbk/cudf that referenced this pull request May 19, 2026
Removes `assert_collect_raises`, its callers, and the leftover `executor=`-era keyword plumbing that is no longer used anywhere else.

Authors:
  - Mads R. B. Kristensen (https://github.com/madsbk)

Approvers:
  - Lawrence Mitchell (https://github.com/wence-)
  - Matthew Roeschke (https://github.com/mroeschke)

URL: rapidsai#22535
madsbk added a commit to madsbk/cudf that referenced this pull request May 19, 2026
rapidsai#22558)

PR rapidsai#22048 (merged today) added the new `test_hconcat_strict_different_heights` test, which imports `assert_collect_raises`. However, PR rapidsai#22535 (also merged today) removed that helper.

The two PRs landed on `release/26.06` without the conflict being noticed.

On `main`, `test_hconcat.py` does not contain the strict-mode test, so the issue is limited to `release/26.06`.

Authors:
  - Mads R. B. Kristensen (https://github.com/madsbk)

Approvers:
  - Matthew Murray (https://github.com/Matt711)

URL: rapidsai#22558
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change cudf-polars Issues specific to cudf-polars improvement Improvement / enhancement to an existing function Python Affects Python cuDF API.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants